using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;

namespace BlazeApps.Library.Resources
{
    public class ResourceList : Base
    {
        public enum ListType
        {
            ByNode = 1,
            ByUser = 2
        }

        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        public DataSet GetResourceList()
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            return DAL.GetDataSet(Procs.ListResource.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetResourceList(Guid NodeID, Guid UserID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);
            string SP = String.Empty;

            DAL.AddParameter("@nodeid", NodeID);
            DAL.AddParameter("@userid", UserID);

            return DAL.GetDataSet(Procs.ListResourceByUserIDNodeID.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetResourceListByNode(Guid NodeID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@nodeid", NodeID);

            return DAL.GetDataSet(Procs.ListResourceByNodeID.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetResourceListByUser(Guid UserID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@userid", UserID);

            return DAL.GetDataSet(Procs.ListResourceByUserID.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetResourceListByItem(Guid ItemID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@itemid", ItemID);

            return DAL.GetDataSet(Procs.ListResourcesByItemID.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }
    }
}
